package java19_3_24_lambda;

/**
 * 不同情况的Lambda表达式使用
 * @author yuisama
 * @date 2022/03/24 21:17
 **/
interface NonReturnNonParameter {
    void test1();
}
interface NonReturnHasParameter {
    void test2(int age,String name);
}
interface HasReturnNonParameter {
    int test3();
}
public class LambdaUsage {
    public static void main(String[] args) {
//        NonReturnNonParameter i1 = () -> System.out.println("test1");
//        i1.test1();
//        NonReturnHasParameter i2 = (t1,t2) -> {
//            t1 = t1 + 1;
//            t2 = "张三";
//            System.out.println("t1 = " + t1 + ", t2 = " + t2);
//        };
//        i2.test2(18,"");
//        HasReturnNonParameter i3 = () -> 10;
//        int ret = i3.test3();
//        System.out.println(ret);
        HasReturnHasParameter i4 = (t1,t2) -> {
            t1 += 100;
            System.out.println(t2);
            return t1;
        };
        int ret = i4.test4(18,"铭哥");
        System.out.println(ret);
    }
}
interface HasReturnHasParameter {
    int test4(int age,String name);
}